package com.briup.controller;

import com.briup.pojo.Book;
import com.briup.pojo.extend.BookExtend;
import com.briup.result.Result;
import com.briup.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/books")
public class BookController {

    @Autowired
    private BookService bookService;

    //条件查询所有书籍
    @GetMapping
    private Result getByCondition(String keyword, Integer categoryId) {
        System.out.println("in bookController, getByCondition() ...");

        List<BookExtend> list = bookService.getBooksByCondition(keyword, categoryId);
        return Result.success(list);
    }


}
